/*

class Solution {
public:
    ListNode* deleteDuplicates(ListNode* head) {
        if (!head)
            return head;
        ListNode* cur = head;
        while (cur && cur->next)
        {
            if (cur->val == cur->next->val)
                cur->next = cur->next->next;
            else
                cur = cur->next;
        }
        return head;
    }
};

class Solution {
public:
    ListNode* deleteDuplicates(ListNode* head) {
        if (!head)
            return head;
        ListNode* phead = new ListNode(0);
        phead->next = head;
        ListNode* cur = phead;
        while (cur->next && cur->next->next)
        {
            if (cur->next->val == cur->next->next->val)
            {
                int temp = cur->next->val;
                while (cur->next && cur->next->val == temp)
                    cur->next = cur->next->next;
            }
            else {
                cur = cur->next;
            }
        }
        return phead->next;
    }
};



*/